% FWEAVE v1.30 (May 15, 1993)

\input fwebmac.sty

\Wbegin[]{article}{1em}{1em}{demo0.cts}{{\&}{\|}{\\}{\\}{\\}{\@}{\.}{\.}}

% --- Beginning of user's limbo section ---




\WN1.  EXAMPLE. The `\.{@*}'~begins a major module or section (one for which an
entry is made in the table of contents). We are now in the \TeX\ part of
the section, in which we can type arbitrary \TeX\ to explain what goes on in
the remainder of the section.

The next statement introduces the definition part of this section.
\modlabel{FirstMod} % Attach an identifying name to this section.

\WY\WP\WMd$\\{PRINT}\WIN2{0}(\\{word}) $\5
$\@{printf}(\.{"\%s\1\ world.\\n"},\39\#\\{word}){}$\5
\WC{ An example of a \.{WEB} macro def'n.  They are compatible with ANSI~C, but
have extensions (not illustrated here) that will be explained later. Long
comments that extend over more than one line can be written like this, in the C
commenting style. }\WY\par
\WY${}\WP \\{main}\WIN1{0}(\,)$\1\6
${}\{$\6
\\{PRINT}\WIN2{0}(\\{Hello});\5
\WC{ Bullets as subscripts indicate that the name is defined in the current
section. }\6
${}\\{init}\WIN1{3}(\,);{}$\5
\WC{ Example of a function call.  The subscript is inserted automatically, and
indicates in which section the function is defined. }\6
\WX2:Do the computations\X \X;\5
\WC{ Use of named modules makes the code readable. Again, the section number
where this module is defined is inserted automatically. }\6
\\{PRINT}\WIN2{0}(\\{Goodbye});\6
${}\}$\2\WY\par
\fi % End of module 1

\WM2. The `\.{@\ }'~begins a minor section.  (No entry is made in the table of
contents.)  Here the named fragment \WCD{ \WX2:Do the computations\X \X} used
in the previous module
is actually defined.  (The definition part of this section is empty.) The
name of this module is `Do the computations'; it can be abbreviated (using
an ellipsis) for simplicity in the source because it appeared earlier in
full; however, when it's printed the full name will be used for
readability.

\WY\WP\4\4\WX2:Do the computations\X \X${}\WS{}$\6
${}\{{}$\5
\WC{ Put arbitrary C code here. }\6
$\,\}{}$\WY\par
\WU section~1.\fi % End of module 2

\WM3. In general, function names don't carry as much information as do named
modules, since a module name can be arbitrarily long and complicated.  But
function calls have their place as well, as described later.

This function is actually accreted to the unnamed module begun in
\WEBsection{FirstMod}.  Examine the source listing to see how the section
number in the last sentence was generated automatically through the use of
\FWEB's \TeX\ macros \.{\\modlabel} and \.{\\WEBsection}.

\WY\WP \&{void} \1\\{init}\WIN1{0}(\&{void})\2\1\6
${}\{\,\}$\2\WY\par
\fi % End of module 3

\WN4.  INDEX.  It's customary to make the index the last major module.
\fi % End of module 4

\input demo0.ndx
\input demo0.mds

\Winfo{"fweave ./demo0 -zdemos.sty -=demo0.tex"}  {"./demo0.web"} {(none)}
 {C}

\Wcon
